More QString tweaks.
authorrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 1 Jan 2014 04:22:06 +0000 (04:22 +0000)
committerrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 1 Jan 2014 04:22:06 +0000 (04:22 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4692 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/alan.cc
gpsbabel/bushnell.cc
gpsbabel/dmtlog.cc

index 3ae0dcb550059d1bed8a842a91051d9348c305ac..e4b10901de47652ddcb22b0a6014c8a0d336b26a 100644 (file)
@@ -513,7 +513,9 @@ static waypoint* get_wpt(struct wprdata* wprdata, unsigned n)
   WP->longitude =  pt2deg(wpt->pt.x);
   WP->SetCreationTime(unpack_time(wpt->date, wpt->time));
   for (j=WPT_NAME_LEN-1; j >= 0 && wpt->name[j] == ' '; j--) {};
-  WP->shortname = xstrndup(wpt->name,j+1);
+  char *s = xstrndup(wpt->name,j+1);
+  WP->shortname = s;
+  xfree(s);
   for (j=WPT_COMMENT_LEN-1; j >= 0 && wpt->comment[j] == ' '; j--) {};
   if (j >= 0) {
     char *s = xstrndup(wpt->comment, j+1);
@@ -565,12 +567,16 @@ static void wpr_read(void)
     RT = route_head_alloc();
     RT->rte_num = i;
     for (j=RTE_NAME_LEN-1; j >= 0 && rte->name[j] == ' '; j--) {};
-    RT->rte_name = xstrndup(rte->name,j+1);
+    char *s = xstrndup(rte->name,j+1);
+    RT->rte_name = s;
+    xfree(s);
     for (j=RTE_COMMENT_LEN-1; j >= 0 && rte->comment[j] == ' '; j--) {};
     if (j >= 0) {
-      RT->rte_desc = xstrndup(rte->comment,j+1);
+      char *s = xstrndup(rte->comment,j+1);
+      RT->rte_desc = s;
+      xfree(s);
     } else {
-      RT->rte_desc = xstrdup("");
+      RT->rte_desc = "";
     }
 
     route_add_head(RT);
index 479e1b48d18ef0505f053bd9ab0cb9a217ab7bec..5c712ab9d2f4f1530ee7a73c57fea9d854fcf602 100644 (file)
@@ -219,7 +219,7 @@ bushnell_read(void)
 
   // Apparently this is always zero terminated, though it's never been
   // observed to be longer than 19 bytes + a null terminator.
-  wpt_tmp->shortname = xstrdup(gbfgetstr(file_in));
+  wpt_tmp->shortname = gbfgetstr(file_in);
 
   waypt_add(wpt_tmp);
 }
index bcb7408e7d4e874f82de0cd3998ab00f4eac70a4..8a153dd9be6706cd04d3f4f4f812442ba9a205d2 100644 (file)
@@ -283,13 +283,7 @@ tlog3b_xgcb_tpten(xg_string args, const QXmlStreamAttributes* unused)
 static void
 tlog3b_xgcb_wptid(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   xmlwpt->shortname = args;
-#else
-  if (*args) {
-    xmlwpt->shortname = xstrdup(args);
-  }
-#endif
 }
 
 
@@ -319,33 +313,20 @@ tlog3b_xgcb_wptgr(xg_string args, const QXmlStreamAttributes* unused)
 static void
 tlog3b_xgcb_wptno(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   xmlNorthing = args.toDouble();
-#else
-  xmlNorthing = atof(args);
-#endif
 }
 
-
 static void
 tlog3b_xgcb_wptea(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   xmlEasting = args.toDouble();
-#else
-  xmlEasting = atof(args);
-#endif
 }
 
 
 static void
 tlog3b_xgcb_wptal(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   xmlAltitude = args.toDouble();
-#else
-  xmlAltitude = atof(args);
-#endif
 }
 
 
@@ -595,10 +576,10 @@ read_CTrackFile(const int version)
       if (name && *name) {
         switch (i) {
         case 0:
-          wpt->description = xstrdup(name);
+          wpt->description = name;
           break;
         case 1:
-          wpt->shortname = xstrdup(name);
+          wpt->shortname = name;
           break;
         }
       }